package thread;

class MyThread extends Thread{
    public void run(){
        while(true){
            System.out.println("Hello world");
        }
    }
}
public class ThreadDemo1 {
    public static void main(String[] args) {
        Thread t= new MyThread();
        t.start();//启动一个线程——>没有调用run start是创建了个线程，由新的线程来执行run方法
        while(true){
            System.out.println("hello main");
        }
    }
}
